import Vue from "vue";
import VueRouter from "vue-router";

import Home from "@/views/Home.vue";

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "/home",
      // component: Home,
      components: {
        // key: value
        //    key 坑名
        //    value 对应的组件
        top: Home,
        bottom: {
          // template: `
          //   <div>
          //     <h1>1</h1>
          //     <p>p</p>
          //   </div>
          // `,
          render: (createElement) =>
            createElement("div", null, [
              createElement("h1", null, "1"),
              createElement("p", null, "p"),
            ]),
        },
        default: {
          render: (createElement) => createElement("div", null, "default组件"),
        },
      },
    },
  ],
});

export default router;
